import { get, set } from '@/utils/auth'
import { getCommonConfig } from '@/api/config'

const state = {
  inFilePrefix: '',
  outFilePrefix: '',
  livePreview: ''
}
const mutations = {
  setConfig (state, data) {
    state.inFilePrefix = data.inFilePrefix
    state.outFilePrefix = data.outFilePrefix
    state.livePreview = data.livePreview
  },
  remmoveConfig (state) {
    state.inFilePrefix = ''
    state.outFilePrefix = ''
    state.livePreview = ''
  }

}
const actions = {
  setConfig ({ commit }) {
    getCommonConfig().then(res => {
      if (res.code === 200) {
        commit('setConfig', res.data)
      }
    })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}